package com.example.common.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.blankj.utilcode.util.ToastUtils

abstract class BaseActivity<VDB:ViewDataBinding>:AppCompatActivity(){
    lateinit var mDatabinding:VDB

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mDatabinding = DataBindingUtil.setContentView(this,getLayoutId())

        //初始化组件
        initViews()
    }
    fun showToast(msg:String){
        if(msg!=null){
            ToastUtils.showLong(msg)
        }
    }
    abstract fun initViews()

    abstract fun getLayoutId(): Int

}